#pragma once

#include "parallelSettings.h"
#include "Matrix.h"
#include "BlockList.h"
#include <algorithm>

struct MADInfoContainer {
	Matrix diff;
	Matrix comparingBlock;
	double MAD;
	int8_t x;
	int8_t y;
	uint32_t type;
};

struct cudaMADInfoContainer {
	int targetX;
	int targetY;
	int8_t x;
	int8_t y;
	double MAD;
	uint32_t type;
};

class ME
{
private:
	int _columnSize;
	int _width;
	int _height;
	int _meRange;
public:
	ME(int columnSize, int width, int height, int meRange);
	~ME(void);
	MADInfoContainer calculateMotionVector(Matrix& targetBlock, int tbX, int tbY, BlockList& previousFrame);
	Matrix* calculateDifference(Matrix* target, Matrix* reference);
	double calculateMAD(Matrix& matrix);
};

